home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.6 / linuxcon / usr / lib / linuxconf / mailconf / rulesets.cf < prev    next >
Encoding:
Text File  |  1996-08-04  |  7.4 KB  |  261 lines

  1.  
  2. ##################################################
  3. ###  Ruleset 4 -- Final Output Post-rewriting  ###
  4. ##################################################
  5. S4
  6.  
  7. R$*<@>            $@ $1                handle <> and list:;
  8.  
  9. # strip trailing dot off possibly canonical name
  10. R$* < @ $+ . > $*    $1 < @ $2 > $3
  11.  
  12. # externalize local domain info
  13. R$* < $+ > $*        $1 $2 $3            defocus
  14. R@ $+ : @ $+ : $+    @ $1 , @ $2 : $3        <route-addr> canonical
  15. R@ $*            $@ @ $1                ... and exit
  16.  
  17.  
  18. # delete duplicate local names
  19. R$+ % $=w @ $=w        $1 @ $j                u%host@host => u@host
  20.  
  21.  
  22.  
  23. ##############################################################
  24. ###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
  25. ###           (used for recursive calls)           ###
  26. ##############################################################
  27.  
  28. S97
  29. R$*            $: $>3 $1
  30. R$*            $@ $>0 $1
  31.  
  32. ###########################################################################
  33. ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
  34. ###           (new sendmail only)                    ###
  35. ###########################################################################
  36.  
  37. S5
  38.  
  39. # see if we have a relay or a hub
  40. R$+            $: < $R > $1            try relay
  41. R< > $+            $: < $H > $1            try hub
  42. R< > $+            $@ $1                nope, give up
  43. R< $- : $+ > $+        $: $>95 < $1 : $2 > $3 < @ $2 >
  44. R< $+ > $+        $@ $>95 < $1 > $2 < @ $1 >
  45.  
  46.  
  47. ###################################################################
  48. ###  Ruleset 90 -- try domain part of mailertable entry     ###
  49. ###           (new sendmail only)                ###
  50. ###################################################################
  51.  
  52. S90
  53. R$* <$- . $+ > $*    $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
  54. R$* <$- : $+ > $*    $# $2 $@ $3 $: $4        check -- resolved?
  55. R$* < . $+ > $*        $@ $>90 $1 . <$2> $3        no -- strip & try again
  56. R$* < $* > $*        $: < $(mailertable . $@ $1$2 $) > $3    try "."
  57. R<$- : $+ > $*        $# $1 $@ $2 $: $3        "." found?
  58. R< $* > $*        $@ $2                no mailertable match
  59.  
  60. ###################################################################
  61. ###  Ruleset 95 -- canonify mailer:host syntax to triple    ###
  62. ###################################################################
  63.  
  64. S95
  65. R< > $*            $@ $1                strip off null relay
  66. R< $- : $+ > $*        $# $1 $@ $2 $: $3        try qualified mailer
  67. R< $=w > $*        $@ $2                delete local host
  68. R< $+ > $*        $#$N $@ $1 $: $2        use unqualified mailer
  69.  
  70. ###################################################################
  71. ###  Ruleset 98 -- local part of ruleset zero (can be null)    ###
  72. ###################################################################
  73.  
  74. S98
  75.  
  76. # addresses sent to foo@host.REDIRECT will give a 551 error code
  77. R$* < @ $+ .REDIRECT. >    $# error $@ NOUSER $: "551 User not local; please try " <$1@$2>
  78. ######################################################################
  79. ######################################################################
  80. #####
  81. #####            MAILER DEFINITIONS
  82. #####
  83. ######################################################################
  84. ######################################################################
  85.  
  86. S10
  87. R<@>            $n            errors to mailer-daemon
  88. R$+            $: $>40 $1
  89.  
  90. S20
  91. R$+ < @ $* >        $: $1            strip host part
  92.  
  93. S40
  94.  
  95. #
  96. #  envelope sender and masquerading recipient rewriting
  97. #
  98. S11
  99. R$+            $: $>51 $1            sender/recipient common
  100. R$* :; <@>        $@ $1 :;            list:; special case
  101. R$*            $@ $>61 $1            qualify unqual'ed names
  102.  
  103.  
  104. #
  105. #  header recipient rewriting if not masquerading recipients
  106. #
  107. S21
  108.  
  109. # do sender/recipient common rewriting
  110. R$+            $: $>51 $1
  111.  
  112. # unqualified names (e.g., "eric") are qualified by local host
  113. R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  114. R$+            $: $1 < @ $j >            add local domain
  115.  
  116.  
  117. #
  118. #  header sender and masquerading recipient rewriting
  119. #
  120. S31
  121. R$+            $: $>51 $1            sender/recipient common
  122. R$* :; <@>        $@ $1 :;            list:; special case
  123.  
  124. # do special header rewriting
  125. R$* <@> $*        $@ $1 <@> $2            pass null host through
  126. R< @ $* > $*        $@ < @ $1 > $2            pass route-addr through
  127. R$=E < @ $=w . >    $@ $1 < @ $2 >            exposed user as is
  128. R$* < @ $=w . >        $: $1 < @ $2 @ $M >        masquerade as domain
  129. R$* < @ $+ @ >        $@ $1 < @ $2 >            in case $M undefined
  130. R$* < @ $+ @ $+ >    $@ $1 < @ $3 >            $M is defined -- use it
  131. R$*            $@ $>61 $1            qualify unqual'ed names
  132.  
  133.  
  134. #
  135. #  convert pseudo-domain addresses to real domain addresses
  136. #
  137. S51
  138.  
  139. # pass <route-addr>s through
  140. R< @ $+ > $*        $@ < @ $1 > $2            resolve <route-addr>
  141.  
  142. # output fake domains as user%fake@relay
  143. R$+ <@ $+ .BITNET. >    $: $1 % $2 .BITNET < @ $B >    user@host.BITNET
  144. R$+.BITNET <@ $+:$+ >    $: $1 .BITNET < @ $3 >        strip mailer: part
  145.  
  146. # do UUCP heuristics; note that these are shared with UUCP mailers
  147. R$+ < @ $+ .UUCP. >    $: < $2 ! > $1            convert to UUCP form
  148. R$+ < @ $* > $*        $@ $1 < @ $2 > $3        not UUCP form
  149.  
  150. # leave these in .UUCP form to avoid further tampering
  151. R< $&h ! > $- ! $+    $@ $2 < @ $1 .UUCP. >
  152. R< $&h ! > $-.$+ ! $+    $@ $3 < @ $1.$2 >
  153. R< $&h ! > $+        $@ $1 < @ $&h .UUCP. >
  154. R< $+ ! > $+        $: $1 ! $2 < @ $Y >
  155. R$+ < @ >        $: $1 < @ $j >            in case $Y undefined
  156. R$+ < @ $+ : $+ >    $: $1 < @ $3 >            strip mailer: part
  157.  
  158.  
  159. #
  160. #  common sender and masquerading recipient rewriting
  161. #
  162. S61
  163.  
  164. R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  165. R$=E            $@ $1 < @ $j>            show exposed names
  166. R$+            $: $1 < @ $M >            user w/o host
  167. R$+ <@>            $: $1 < @ $j >            in case $M undefined
  168.  
  169. #
  170. #  envelope and header sender rewriting
  171. #
  172. S12
  173.  
  174. # handle error address as a special case
  175. R<@>                $n            errors to mailer-daemon
  176.  
  177. # do not qualify list:; syntax
  178. R$* :; <@>            $@ $1 :;
  179.  
  180. R$* < @ $* . >            $1 < @ $2 >        strip trailing dots
  181. R$* < @ $=w >            $1            strip local name
  182. R<@ $- . UUCP > : $+        $1 ! $2            convert to UUCP format
  183. R<@ $+ > : $+            $1 ! $2            convert to UUCP format
  184. R$* < @ $- . UUCP >        $2 ! $1            convert to UUCP format
  185. R$* < @ $+ >            $2 ! $1            convert to UUCP format
  186. R$&h ! $+ ! $+            $@ $1 ! $2        $h!...!user => ...!user
  187. R$&h ! $+            $@ $&h ! $1        $h!user => $h!user
  188. R$+                $: $U ! $1        prepend our name
  189. R! $+                $: $k ! $1        in case $U undefined
  190.  
  191. #
  192. #  envelope recipient rewriting
  193. #
  194. S22
  195.  
  196. # don't touch list:; syntax
  197. R$* :; <@>            $@ $1 :;
  198.  
  199. R$* < @ $* . >            $1 < @ $2 >        strip trailing dots
  200. R$* < @ $j >            $1            strip local name
  201. R<@ $- . UUCP > : $+        $1 ! $2            convert to UUCP format
  202. R<@ $+ > : $+            $1 ! $2            convert to UUCP format
  203. R$* < @ $- . UUCP >        $2 ! $1            convert to UUCP format
  204. R$* < @ $+ >            $2 ! $1            convert to UUCP format
  205.  
  206. #
  207. #  header recipient rewriting
  208. #
  209. S42
  210.  
  211. # don't touch list:; syntax
  212. R$* :; <@>            $@ $1 :;
  213.  
  214. R$* < @ $* . >            $1 < @ $2 >        strip trailing dots
  215. R$* < @ $j >            $1            strip local name
  216. R<@ $- . UUCP > : $+        $1 ! $2            convert to UUCP format
  217. R<@ $+ > : $+            $1 ! $2            convert to UUCP format
  218. R$* < @ $- . UUCP >        $2 ! $1            convert to UUCP format
  219. R$* < @ $+ >            $2 ! $1            convert to UUCP format
  220. R$&h ! $+ ! $+            $@ $1 ! $2        $h!...!user => ...!user
  221. R$&h ! $+            $@ $&h ! $1        $h!user => $h!user
  222. R$+                $: $U ! $1        prepend our name
  223. R! $+                $: $k ! $1        in case $U undefined
  224.  
  225.  
  226. #
  227. #  envelope sender rewriting for uucp-dom mailer
  228. #
  229. S52
  230.  
  231. # handle error address as a special case
  232. R<@>                $n            errors to mailer-daemon
  233.  
  234. # pass everything to standard SMTP mailer rewriting
  235. R$*                $@ $>11 $1
  236.  
  237. #
  238. #  envelope sender rewriting for uucp-uudom mailer
  239. #
  240. S72
  241.  
  242. # handle error address as a special case
  243. R<@>                $n            errors to mailer-daemon
  244.  
  245. # do not qualify list:; syntax
  246. R$* :; <@>            $@ $1 :;
  247.  
  248. R$* < @ $* . >            $1 < @ $2 >        strip trailing dots
  249. R$* < @ $=w >            $1            strip local name
  250. R<@ $- . UUCP > : $+        $1 ! $2            convert to UUCP format
  251. R<@ $+ > : $+            $1 ! $2            convert to UUCP format
  252. R$* < @ $- . UUCP >        $2 ! $1            convert to UUCP format
  253. R$* < @ $+ >            $@ $2 ! $1        convert to UUCP format
  254.  
  255. R$&h ! $+ ! $+            $@ $1 ! $2        $h!...!user => ...!user
  256. R$&h ! $+            $@ $&h ! $1        $h!user => $h!user
  257. R$+                $: $M ! $1        prepend masquerade name
  258. R! $+                $: $j ! $1        in case $M undefined
  259.  
  260.  
  261.